package com.xc.ezplan.admin.controller;

import com.xc.ezplan.admin.service.AdminEmailService;
import com.xc.ezplan.admin.vo.AdminEmailVo;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.xc.ezplan.core.base.EzResult;
import com.xc.ezplan.log.annotation.Log;

import cn.dev33.satoken.annotation.SaCheckPermission;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

/**
 * @author lixingchen
 * @date 2022/12/10
 * @description 邮件模板
 */
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping("/email")
@Api(tags = "邮件发送")
public class AdminEmailController {
	private final AdminEmailService adminEmailService;

	@Log("发送邮件")
	@ApiOperation("发送邮件")
	@PostMapping("/send")
	@SaCheckPermission("mail.config.send")
	public EzResult<Object> sendEmail(@Validated @RequestBody AdminEmailVo adminEmailVo) {
		adminEmailService.sendEmail(adminEmailVo);
		return EzResult.ok();
	}

}
